package de.hsos.mad;

import java.io.IOException;
import java.io.InputStream;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.webkit.WebView;

public class HelpActivity extends Activity {
	/** Called when the activity is first created. */ @Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState); 
		setContentView(R.layout.help);
		
		final WebView view = (WebView) findViewById (R.id.webView); 
		view.getSettings().setJavaScriptEnabled(true); 
		initializeWebKit (view, this);
		view.bringToFront();
	}
	
	private void initializeWebKit (WebView view, Context context) { 
		final String mimeType = "text/html";
		final String encoding = "UTF-8";
		String htmldata;
		int contextMenuId = R.raw.help_complete;
		InputStream is = context.getResources().openRawResource(contextMenuId);
		try {
            if (is != null && is.available() > 0) {
				final byte[] bytes = new byte[is.available()]; is.read(bytes);
				htmldata = new String (bytes); view.loadDataWithBaseURL (null, htmldata, mimeType,
				encoding, null);
            }
		} 
		catch (IOException e) {
			
		}
    }
}